﻿Imports System.Globalization

Namespace Converters
    Public Class OppositeBooleanToVisibility
        Implements IValueConverter

        Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.Convert
            If Not CBool(value) Then
                Return System.Windows.Visibility.Visible
            Else
                Return System.Windows.Visibility.Collapsed
            End If
        End Function

        Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object _
         Implements IValueConverter.ConvertBack
            Dim visibility As System.Windows.Visibility = CType(value, System.Windows.Visibility)

            Return If(visibility = System.Windows.Visibility.Visible, False, True)
        End Function

    End Class
End Namespace
